<?php
/**
 * @Author:: HuangYin
 * @DateTime: 2017-01-16 20:01
 *
 * @Description: 接口文档
 */

/**
 * @api {post} goods 商品 - 唯一编码返回详情
 * @apiVersion 1.0.0
 * @apiName getGoodsDetail
 * @apiGroup Goods
 *
 * @apiParam    {string}     keywords       唯一编码[条形码, 货号, 助记码]
 *
 * @apiSuccess {int}        goods_id        分类 ID
 * @apiSuccess {int}        category_id     分类 ID
 * @apiSuccess {string}     category_name   分类名称
 * @apiSuccess {string}     article_no      货号
 * @apiSuccess {string}     bar_code        条形码
 * @apiSuccess {string}     zh_name         中文名称
 * @apiSuccess {string}     en_name         英文名称
 * @apiSuccess {string}     mnemonic        助记码
 * @apiSuccess {string}     brand           品牌
 * @apiSuccess {decimal}    tax             税额
 * @apiSuccess {decimal}    price           价格
 * @apiSuccess {int}        inventory       库存
 * @apiSuccess {int}        status          状态[1:正常, 2:下架]
 * @apiSuccess {int}        created_at      创建时间
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *                  "category_id": 1,
 *                  "category_name": "水果",
 *                  "article_no": "100001",
 *                  "bar_code": "282017011789920705",
 *                  "zh_name": "香蕉",
 *                  "en_name": "banner",
 *                  "mnemonic": "100001",
 *                  "brand": "水果",
 *                  "tax": "Fuck",
 *                  "price": 50.00,
 *                  "inventory": "Fuck",
 *                  "status": "Fuck",
 *                  "created_at": "2016-10-11 16:14:06"
 *          }
 *      }
 */

/**
 * @api {post} member/phone 会员 - 手机详情
 * @apiVersion 1.0.0
 * @apiName getMemberDetailByPhone
 * @apiGroup Member
 *
 * @apiParam    {string}    phone           手机
 *
 * @apiSuccess {int}        uid             ID
 * @apiSuccess {string}     phone           电话号码
 * @apiSuccess {string}     number          卡号
 * @apiSuccess {string}     real_name       真实姓名
 * @apiSuccess {string}     memo            备注
 * @apiSuccess {int}        status          状态[1:正常, 2:锁定, 3:禁用]
 * @apiSuccess {int}        created_at      创建时间
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *                  "uid": 1,
 *                  "phone": "15157123839",
 *                  "number": "Fuck",
 *                  "real_name": "Fuck",
 *                  "memo": "Fuck",
 *                  "status": 1,
 *                  "created_at": "2016-10-11 16:14:06"
 *          }
 *      }
 */

/**
 * @api {post} member/number 会员 - 卡号详情
 * @apiVersion 1.0.0
 * @apiName getMemberDetailByNumber
 * @apiGroup Member
 *
 * @apiParam    {string}    number           手机
 *
 * @apiSuccess {int}        uid             ID
 * @apiSuccess {string}     phone           电话号码
 * @apiSuccess {string}     number          卡号
 * @apiSuccess {string}     real_name       真实姓名
 * @apiSuccess {string}     memo            备注
 * @apiSuccess {float}      integral        积分
 * @apiSuccess {decimal}    money           余额
 * @apiSuccess {int}        status          状态[1:正常, 2:锁定, 3:禁用]
 * @apiSuccess {int}        created_at      创建时间
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *                  "id": 1,
 *                  "uid": 1,
 *                  "phone": "15157123839",
 *                  "number": "Fuck",
 *                  "real_name": "Fuck",
 *                  "integral": "Fuck",
 *                  "money": "Fuck",
 *                  "memo": "Fuck",
 *                  "status": 1,
 *                  "created_at": "2016-10-11 16:14:06"
 *          }
 *      }
 */

/**
 * @api {post} member 会员 - 创建
 * @apiVersion 1.0.0
 * @apiName createdMember
 * @apiGroup Member
 *
 * @apiParam {string}     phone           电话号码
 * @apiParam {string}     number          卡号
 * @apiParam {string}     real_name       真实姓名
 * @apiParam {string}     memo            备注
 * @apiParam {int}        status          状态[1:正常, 2:锁定, 3:禁用]
 *
 *  @apiParamExample {json} Request-Example:
 *     {
 *       "phone": "15157123839",
 *       "number": "6228656478952365",
 *       "real_name": "6228656478952365",
 *       "memo": "6228656478952365",
 *       "status": 1,
 *     }
 *
 * @apiSuccess {int}        id          ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {post} member/{id} 会员 - 更新
 * @apiVersion 1.0.0
 * @apiName updatedMember
 * @apiGroup Member
 *
 * @apiParam {int}        id              ID
 *
 * @apiParam {string}     phone           电话号码
 * @apiParam {string}     number          卡号
 * @apiParam {string}     real_name       真实姓名
 * @apiParam {string}     memo            备注
 * @apiParam {int}        status          状态[1:正常, 2:锁定, 3:禁用]
 * @apiParam {int}        created_at      创建时间
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *       "phone": "15157123839",
 *       "number": "6228656478952365",
 *       "real_name": "6228656478952365",
 *       "memo": "6228656478952365",
 *       "status": 1,
 *     }
 *
 * @apiSuccess {int}   id  会员 ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {post} member/recharge 会员充值 - 创建
 * @apiVersion 1.0.0
 * @apiName createdMemberRecharge
 * @apiGroup Member
 *
 * @apiParam {int}        uid             UID
 * @apiParam {int}        store_id        门店 ID
 * @apiParam {decimal}    money           金额
 * @apiParam {int}        type            类型[1:充值, 2:消费, 3:消耗]
 * @apiParam {string}     memo            备注
 * @apiParam {int}        status          状态[1:成功, 2:失败]
 *
 *  @apiParamExample {json} Request-Example:
 *     {
 *       "uid": 1,
 *       "store_id": 1,
 *       "money": 1,
 *       "type": 1,
 *       "memo": "langLiGeLang",
 *       "status": 1
 *     }
 *
 * @apiSuccess {int}        id          ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {post} member/recharge/{id} 会员充值 - 更新
 * @apiVersion 1.0.0
 * @apiName updatedMemberRecharge
 * @apiGroup Member
 *
 * @apiParam {int}        id              ID
 *
 * @apiParam {int}        uid             UID
 * @apiParam {int}        store_id        门店 ID
 * @apiParam {decimal}    money           金额
 * @apiParam {int}        type            类型[1:充值, 2:消费, 3:消耗]
 * @apiParam {string}     memo            备注
 * @apiParam {int}        status          状态[1:成功, 2:失败]
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *       "uid": 1,
 *       "store_id": 1,
 *       "money": 1,
 *       "type": 1,
 *       "memo": "langLiGeLang",
 *       "status": 1
 *     }
 *
 * @apiSuccess {int}   id  充值 ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {get} shopping/cart?member_id=1 购物车 - 列表
 * @apiVersion 1.0.0
 * @apiName getShoppingCartList
 * @apiGroup ShoppingCart
 *
 * @apiParam    {int}       member_id       每页个数
 *
 * @apiSuccess {int}        id              ID
 * @apiSuccess {int}        uid             会员 ID
 * @apiSuccess {int}        goods_id        商品 ID
 * @apiSuccess {string}     name            商品名称
 * @apiSuccess {decimal}    price           商品价格
 * @apiSuccess {int}        counts          商品数量
 * @apiSuccess {int}        created_at      创建时间
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "list": [
 *                  {
 *                     "id": 1,
 *                     "uid": 1,
 *                     "goods_id": 1,
 *                     "zh_name": "商品名称",
 *                     "en_name": "商品名称",
 *                     "price": "20.17",
 *                     "counts": 1,
 *                     "created_at": "2016-10-11 16:14:06"
 *                  }
 *              ],
 *              "total": 8,
 *              "totalPage": 8,
 *              "currentPage": 8
 *          }
 *      }
 */

/**
 * @api {post} shopping/cart 购物车 - 创建
 * @apiVersion 1.0.0
 * @apiName createdShoppingCart
 * @apiGroup ShoppingCart
 *
 * @apiParam {int}        goods_id        门店 ID
 * @apiParam {int}        member_id       会员 ID
 *
 *  @apiParamExample {json} Request-Example:
 *     {
 *         "goods_id": 1,
 *         "member_id": 1
 *     }
 *
 * @apiSuccess {int}        id          ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": true
 *     }
 */

/**
 * @api {post} shopping/cart/{id} 购物车 - 更新数量
 * @apiVersion 1.0.0
 * @apiName updatedShoppingCart
 * @apiGroup ShoppingCart
 *
 * @apiParam {int}        id              ID
 * @apiParam {int}        counts          商品数量
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *         "counts": 11
 *     }
 *
 * @apiSuccess {int}   id  详情 ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {post} shopping/cart/delete 购物车 - 删除商品[支持批量]
 * @apiVersion 1.0.0
 * @apiName deletedShoppingCart
 * @apiGroup ShoppingCart
 *
 * @apiParam {int}        ids        商品 ID
 *
 *  @apiParamExample {json} Request-Example:
 *     {
 *         "ids": [1,2,3],
 *     }
 *
 * @apiSuccess {int}        id          ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {post} shopping/cart/clear 购物车 - 清空购物车
 * @apiVersion 1.0.0
 * @apiName shoppingCartClear
 * @apiGroup ShoppingCart
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {get} shopping/cart/pending 购物车挂单 - 列表
 * @apiVersion 1.0.0
 * @apiName getShoppingCartPending
 * @apiGroup ShoppingCart
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": [
 *              {
 *                  "id": 1,
 *                  "uid": 1,
 *                  "admin_id": 1,
 *                  "goods_id": 1,
 *                  "zh_name": "香蕉",
 *                  "en_name": "banner",
 *                  "price": "50",
 *                  "counts": 2,
 *                  "status": 2,
 *                  "pending_no": 1487140846,
 *                  "created_at": "2017-02-15 14:38:53"
 *              }
 *          ]
 *     }
 */

/**
 * @api {post} shopping/cart/pending 购物车挂单 - 详情
 * @apiVersion 1.0.0
 * @apiName shoppingCartPendingDetail
 * @apiGroup ShoppingCart
 *
 * @apiParam {int}        pending_no        挂单号
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *         "pending_no": 1485156873,
 *     }
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1,
 *              "uid": 1,
 *              "admin_id": 1,
 *              "goods_id": 1,
 *              "zh_name": "香蕉",
 *              "en_name": "banner",
 *              "price": "100",
 *              "counts": 10,
 *              "status": 1,
 *              "pending_no": 1485156873,
 *              "created_at": "2017-02-07 10:33:19",
 *          }
 *     }
 */

/**
 * @api {post} shopping/cart/created 购物车挂单 - 创建
 * @apiVersion 1.0.0
 * @apiName createdShoppingCartPending
 * @apiGroup ShoppingCart
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": true
 *     }
 */

/**
 * @api {post} shopping/cart/cancel 购物车挂单 - 取消
 * @apiVersion 1.0.0
 * @apiName shoppingCartCancel
 * @apiGroup ShoppingCart
 *
 * @apiParam {int}        pendingNo        挂单号
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *         "pending_no": 1485156873,
 *     }
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": true
 *     }
 */

/**
 * @api {post} shopping/cart/get 购物车挂单 - 获取
 * @apiVersion 1.0.0
 * @apiName shoppingCartGet
 * @apiGroup ShoppingCart
 *
 * @apiParam {int}        pendingNo        挂单号
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *         "pending_no": 1485156873,
 *     }
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": true
 *     }
 */

/**
 * @api {post} shopping 购物 - 创建
 * @apiVersion 1.0.0
 * @apiName createdShopping
 * @apiGroup Shopping
 *
 * @apiParam {int}          uid             会员 ID
 * @apiParam {string}       authCode        商户授权码
 * @apiParam {string}       cardAmount      卡片金额
 * @apiParam {string}       amount          金额
 * @apiParam {string}       payType         支付方式[1:人民币, 2:银行卡, 3:积分兑换, 4:微信, 5:支付宝, 6:会员卡, 7:礼券]
 *
 *  @apiParamExample {json} Request-Example:
 *     {
 *         "uid": 1,
 *         "authCode": "280124568532564",
 *         "cardAmount": "168.88",
 *         "amount": "186.66",
 *         "payType": "Fuck",
 *     }
 *
 * @apiSuccess {int}        id          ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {post} shopping/detail 购物 - 购物号返回详情
 * @apiVersion 1.0.0
 * @apiName getShoppingDetail
 * @apiGroup Shopping
 *
 * @apiParam    {string}    tradeNo         购物号
 *
 * @apiSuccess {int}        id              购物 ID
 * @apiSuccess {int}        uid             会员 ID
 * @apiSuccess {string}     out_trade_no    商户购物号
 * @apiSuccess {string}     auth_code       商户授权码
 * @apiSuccess {string}     card_amount     会员卡金额
 * @apiSuccess {string}     amount          金额
 * @apiSuccess {string}     trade_no        交易号
 * @apiSuccess {string}     pay_type        支付方式[1:人民币, 2:银行卡, 3:积分兑换, 4:微信, 5:支付宝, 6:会员卡, 7:礼券]
 * @apiSuccess {int}        pay_status      支付状态[1:成功, 2:失败]
 * @apiSuccess {int}        created_at      创建时间
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 2,
 *              "uid": 0,
 *              "admin_id": 1,
 *              "out_trade_no": "20170224115326952",
 *              "auth_code": "20170206110514739",
 *              "trade_no": "0",
 *              "card_amount": "500",
 *              "amount": "500",
 *              "pay_type": 1,
 *              "pay_status": 1,
 *              "status": 1,
 *              "created_at": "2017-02-24 11:53:26",
 *              "detail": [
 *                  {
 *                      "id": 2,
 *                      "shopping_id": 2,
 *                      "goods_id": 1,
 *                      "zh_name": "香蕉",
 *                      "en_name": "banner",
 *                      "price": "50.00",
 *                      "counts": 1,
 *                      "created_at": "2017-02-24 11:53:26"
 *                  }
 *              ]
 *          }
 *      }
 */

/**
 * @api {post} shopping/refund 购物 - 退货
 * @apiVersion 1.0.0
 * @apiName deletedShoppingRefund
 * @apiGroup Shopping
 *
 * @apiParam {string}       tradeNo         购物号
 * @apiParam {string}       cardAmount      卡片金额
 * @apiParam {string}       amount          金额
 * @apiParam {string}       goodsIds        退货商品 ID
 * @apiParam {string}       counts          退货商品 数量
 *
 *  @apiParamExample {json} Request-Example:
 *     {
 *         "tradeNo": "280124568532564",
 *         "cardAmount": "168.88",
 *         "amount": "186.66",
 *         "goodsIds": [1,2,3],
 *         "counts": [4,5,6],
 *     }
 *
 * @apiSuccess {int}        id          ID
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "id": 1
 *          }
 *     }
 */

/**
 * @api {post} shift/check 交班 - 验证
 * @apiVersion 1.0.0
 * @apiName shiftCheck
 * @apiGroup Shift
 *
 * @apiParam {int}        password      密码
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *         "password": 123456,
 *     }
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": true
 *     }
 */

/**
 * @api {post} shift/Inventory 交班 - 清单
 * @apiVersion 1.0.0
 * @apiName shiftList
 * @apiGroup Shift
 *
 * @apiSuccess {string}     number          交班班号
 *
 * @apiParamExample {json} Request-Example:
 * {
 *     "number": 2017022412091003,
 * }
 *
 * @apiSuccess {int}        payType         支付方式
 * @apiSuccess {decimal}    rmb             人民币
 * @apiSuccess {decimal}    bankCard        银行卡
 * @apiSuccess {decimal}    integral        积分
 * @apiSuccess {decimal}    weChat          微信
 * @apiSuccess {decimal}    payPal          支付宝
 * @apiSuccess {decimal}    memberCard      会员卡
 * @apiSuccess {decimal}    coupon          礼券
 * @apiSuccess {decimal}    goodsType       货物类型
 * @apiSuccess {decimal}    name            分类名称
 * @apiSuccess {decimal}    counts          销售数量
 * @apiSuccess {decimal}    amount          总价格
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *              "payType": {
 *                  "rmb": 5000,
 *                  "bankCard": 5000,
 *                  "integral": 5000,
 *                  "weChat": 5000,
 *                  "payPal": 5000,
 *                  "memberCard": 5000,
 *                  "coupon": 5000,
 *               },
 *              "goodsType": [
 *                  {
 *                      "name":"厨具",
 *                      "counts":10,
 *                      "amount":9527,
 *                  }
 *              ]
 *          }
 *     }
 */

/**
 * @api {post} shift 交班 - 确认
 * @apiVersion 1.0.0
 * @apiName shiftUpdated
 * @apiGroup Shift
 *
 * @apiSuccess {string}     number          交班班号
 *
 * @apiParamExample {json} Request-Example:
 * {
 *     "number": 2017022412091003,
 * }
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": true
 *     }
 */

/**
 * @api {post} login 交班 - 登录
 * @apiVersion 1.0.0
 * @apiName shiftLogin
 * @apiGroup Shift
 *
 * @apiParam {string}       phone       手机号
 * @apiParam {string}       password    密码
 *
 * @apiParamExample {json} Request-Example:
 *     {
 *          "phone": "15111223344",
 *          "password": "123456"
 *     }
 *
 * @apiSuccess {int}        uid         管理员 ID
 * @apiSuccess {string}     phone       电话号码
 * @apiSuccess {string}     real_name   真实姓名
 * @apiSuccess {string}     avatar      图像
 * @apiSuccess {int}        sex         性别[1:男, 2:女]
 * @apiSuccess {int}        role_id     角色[1:店长, 2:店员]
 * @apiSuccess {int}        status      状态[1:正常, 2:锁定, 3:禁用]
 * @apiSuccess {string}     memo        备注
 * @apiSuccess {string}     number      班号
 * @apiSuccess {string}     created_at  创建时间
 * @apiSuccess {string}     token       授权验证 token [作为接口授权验证，通过 Header 方式传递]
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code": 200,
 *          "message": "",
 *          "data": {
 *                  "uid": 4,
 *                  "phone": "15111223344",
 *                  "real_name": "test",
 *                  "avatar": "/avatar.jpg",
 *                  "sex": 2,
 *                  "role_id": 2,
 *                  "status": 1,
 *                  "memo": "Fuck",
 *                  "number": "2017020418132598",
 *                  "created_at": "2016-10-11 16:14:06"
 *          },
 *          token: "KDJSLKLHUHUHJSJDNKKJKPLKNNGCGFT546812212dfdfefwefsdfaSDSDS"
 *      }
 */